#pragma once

#include "Win32Application.h"
#include "Win32Console.h"

#include <list>
using namespace std;


#include "IncidenceGraph.h"
#include "Dijkstra.h"

#include "GraphReader.h"
#include "LayoutReader.h"
#include "LayoutWriter.h"


class DijkstraApp : public Win32Application
{
public:
	DijkstraApp();
	virtual ~DijkstraApp();

protected:
	virtual HRESULT OnCreate();
	virtual void OnRelease();
	virtual bool OnMessage(UINT msg, WPARAM wparam, LPARAM lparam);
	virtual void OnKeyDown(DWORD key);
	virtual void OnChar(char c);
	virtual void OnPaint(Graphics& graphics);
	virtual void OnMouseDown(DWORD button, int x, int y);
	virtual void OnMouseUp(DWORD button, int x, int y);
	virtual void OnMouseMove(DWORD button, int x, int y);

	void DrawAppInfo(Graphics& graphics);
	void DrawGraphInfo(Graphics& graphics);
	void DrawGraph(Graphics& graphics);
	void DrawDijkstraInfo(Graphics& graphics);
	void DrawDijkstra(Graphics& graphics);

private:
	PointF			m_mousePosition;

	list<PointF>	m_points;

	Dijkstra		m_dijkstra;
	IncidenceGraph	m_graph;

	list<Vertex>	m_vertices;
	list<Vertex>::iterator m_vertexIterator;

	list<Edge>		m_edges;
	list<Edge>::iterator m_edgeIterator;

	int				m_mode;		// 0=place, 1=source, 2=target
	Vertex			m_source;
	Vertex			m_target;

	String			m_graphFileName;
	String			m_layoutFileName;
};


